from sqlalchemy import Column, String, create_engine, BIGINT, Integer
from sqlalchemy.orm import sessionmaker


class ConnectionHelper():


    def __init__(self):
        print("connectionHelper init")
        return


    @staticmethod
    def getSessionAndEngine():
        """
        :return: sql session
        """
        # DB_CONNECT_STRING = 'mysql+pymysql://root:root@localhost:3306/xls_data?charset=utf8mb4'
        DB_CONNECT_STRING = 'mysql+pymysql://study:study@www.sobeats.com:3306/xls_data?charset=utf8mb4'
        engine = create_engine(DB_CONNECT_STRING, echo=False)
        # 初始化数据库连接:
        # engine = create_engine('mysql+mysqlconnector://root:root@localhost:3306/ctbu')
        # 创建DBSession类型:
        DBSession = sessionmaker(bind=engine)
        # 创建Session:
        session = DBSession()
        return session,engine
